package com.example.sprinbootdemo.service.impl;


import com.example.sprinbootdemo.entity.AvailableCar;
import com.example.sprinbootdemo.entity.Car;
import com.example.sprinbootdemo.entity.RentCount;
import com.example.sprinbootdemo.mapper.CarMapper;
import com.example.sprinbootdemo.service.CarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CarServiceImpl implements CarService {

    @Autowired
    private CarMapper carMapper;

    @Override
    public List<Car> getAllCars() {
        return carMapper.selectAll();
    }

    @Override
    public void addCar(Car car) {
        carMapper.addCar(car);
    }

    @Override
    public void deleteCarByCarNumber(int carNumber) {
        carMapper.deleteCarByCarNumber(carNumber);
    }

    @Override
    public void updateCarByCarNumber(Car car) {
        carMapper.updateCarByCarNumber(car);
    }

    @Override
    public Car getCarByCarNumber(int carNumber) {
        return carMapper.getCarByCarNumber(carNumber);
    }
    @Override
    public List<AvailableCar> getAvailableCars() {
        return carMapper.getAvailableCars();
    }
    @Override
    public List<AvailableCar> getAvailableCarsByModelName(String modelName) {
        return carMapper.getAvailableCarsByModelName(modelName);
    }
    @Override
    public List<RentCount> getRentCount() {
        return carMapper.getRentCount();
    }
}